package com.caiwangdai.app.backend.api

import com.caiwangdai.app.bean.UserB
import com.caiwangdai.app.bean.UserBankB
import com.caiwangdai.app.bean.UserIdentityB
import com.caiwangdai.app.bean.UserInfoB
import com.caiwangdai.app.bean.base.BaseB
import com.caiwangdai.app.bean.base.NormalResponseB
import io.reactivex.Observable
import okhttp3.MultipartBody
import retrofit2.http.*


interface UserApi {
    //登录

    //获取验证码
    @FormUrlEncoded
    @POST("cashloan/message/Usermsg/sendLoginMsg")
    fun getVerifyCodeInLogin(@Field("mobile") username: String?): Observable<NormalResponseB<BaseB>>

    //登录操作
    @FormUrlEncoded
    @POST("login?type=user")
    fun login(@Field("username") username: String?,
              @Field("phoneCaptchaCode") phoneCaptchaCode: String?): Observable<NormalResponseB<UserB>>


    //注册

    //获取验证码
    @FormUrlEncoded
    @POST("cashloan/message/Usermsg/sendRegisterMsg")
    fun getVerifyCodeInRegister(@Field("mobile") username: String?): Observable<NormalResponseB<BaseB>>

    //注册操作
    @FormUrlEncoded
    @POST("cashloan/user/Register/userRegister")
    fun register(@Field("mobile") username: String?,
                 @Field("verifycode") phoneCaptchaCode: String?,
                 @Field("invitationcode") invitationCode: String?): Observable<NormalResponseB<UserB>>


    //上传图片
    @Multipart
    @POST("cashloan/authentication/Fileupload/uploadFile")
    fun postIdCard(@Part file: MultipartBody.Part,
                   @Part uid: MultipartBody.Part,
                   @Part type: MultipartBody.Part): Observable<NormalResponseB<BaseB>>




    //退出登录
    @POST("cashloan/user/Log/logout")
    fun logout(): Observable<NormalResponseB<BaseB>>

    //获取用户普通信息
    @POST("cashloan/user/Account/getUserInfo")
    fun getUserInfo(): Observable<NormalResponseB<UserInfoB>>

    //获取用户身份信息
    @POST("cashloan/user/Account/getUserAuthInfo")
    fun getUserIdentityInfo(): Observable<NormalResponseB<UserIdentityB>>

    //获取用户银行卡信息
    @POST("cashloan/user/Account/getUserBankInfo")
    fun getUserBankInfo(): Observable<NormalResponseB<UserBankB>>




}